#pragma once
#ifndef __G_LOG_H__
#define __G_LOG_H__

#include <fstream>

#include "GTypes.h"

namespace GUtil
{
	#define G_LOG_TYPE_INFO			"INFO"
	#define G_LOG_TYPE_ERROR		"ERROR"
	#define G_LOG_TYPE_WARNING		"WARNING"
	#define G_LOG_TYPE_PROFILER		"PROFILER"

	class GFileLog
	{
	private:
		std::ofstream			FileStream;

	public:
								GFileLog();
								~GFileLog();

		GSize					GetSize() const;

		bool					Open(const char* FileName);
		void					Close();

		void					Flush();

		void					Write(const char* String);
		void					NewLine();
	
	};

	class GFileLogger
	{
	protected:
		GFileLog				FileLog;
		GUInt32					LineNumber;

								GFileLogger();
								~GFileLogger();

	public:
		bool					SetLogFile(const char* FileName);

		void					Flush();

		void					Log(const char* LogType, const char* Format, ...);
		void					Log(const char* LogType, const char* Format, va_list Arguments);

		static GFileLogger*		GetInstance();
	};

}

#define mGFileLogger	GUtil::GFileLogger::GetInstance()

#endif